cmake_minimum_required(VERSION 2.6)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(common)

option(64BIT "64BIT" FALSE)
if (64BIT)
	add_definitions(-D__64BIT__)
endif()

option(WINDOWS "WINDOWS" FALSE)
if (WINDOWS)
	add_definitions(-D__WINDOWS__)
	add_definitions(-D_WIN32_WINNT=0x0501)
	add_definitions(-W3)
else ()
	add_definitions(-D__LINUX__)
	add_definitions(-Wall)
	if (CMAKE_COMPILER_IS_GNUCXX)
		add_definitions(-std=gnu++0x)
	else ()
		add_definitions(-std=stdc++11)
	endif()
endif()

option(DEBUG "DEBUG" FALSE)
if (DEBUG)
add_definitions(-D__DEBUG__)
endif()

set(PROJINC_dir ${PROJECT_SOURCE_DIR}/../../monkey)

set(common_SOURCES
	${PROJINC_dir}/common/Config.hpp
	${PROJINC_dir}/common/TcpServer.hpp
	TcpServer.cc
	${PROJINC_dir}/common/TcpConnection.hpp
	TcpConnection.cc
	${PROJINC_dir}/common/Logger.hpp
	Logger.cc
	${PROJINC_dir}/common/TimeUtil.hpp
	TimeUtil.cc
	${PROJINC_dir}/common/TcpConnectionStream.hpp
	TcpConnectionStream.cc
	${PROJINC_dir}/common/TcpConnectionInputStream.hpp
	TcpConnectionInputStream.cc
#	${PROJINC_dir}/common/TcpConnectionOutputStream.hpp
#	TcpConnectionOutputStream.cc

	${PROJINC_dir}/common/player/Player.hpp
	player/Player.cc
	${PROJINC_dir}/common/player/PlayerManager.hpp
	player/PlayerManager.cc
	${PROJINC_dir}/common/ByteBuffer.hpp
	ByteBuffer.cc
)

include_directories( 
	${PROJECT_SOURCE_DIR}
	${PROJINC_dir}
	${PROJECT_SOURCE_DIR}/../../deps
	${PROJECT_SOURCE_DIR}/../../deps/pio
)

add_library(common STATIC ${common_SOURCES})